#!/bin/tcsh -ef
####
#
#############################################################################
#                                                                           #
# Title: Cleanup                                                            #
#                                                                           #
# (C) 2dx.org, GNU Plublic License.                                         #
#                                                                           #
# Created..........: 03/01/2006                                             #
# Last Modification: 03/01/2006                                             #
# Author...........: 2dx.org                                                #
#                                                                           #
#############################################################################
#
# SORTORDER: 84
#
# MANUAL: This script will delete most files in the current directory, leaving only the essential image processing results (APH files) and a few other files behind. This will save hard-drive space. There are two levels of cleanliness...
#
# RESET: cleanup_level = "radical"
# RESET: cleanup_mask = "n"
#
# DISPLAY: comment
# DISPLAY: reset_variables
# DISPLAY: imagename
# DISPLAY: nonmaskimagename
#
#$end_local_vars
#
set bin_2dx = ""
set proc_2dx = ""
#
set imagename = ""
set nonmaskimagename = ""
set cleanup_level = ""
set cleanup_mask = ""
#
#$end_vars
#
echo bin_2dx = ${bin_2dx}
echo proc_2dx = ${proc_2dx}
#
set cleanup_mask = "y"
#
set scriptname = 2dx_cleanup
#
echo "<<@progress: 1>>"
#
source ${proc_2dx}/initialize
#
set level = `echo ${cleanup_level} | cut -d\  -f1`
#
############################################################################# 
############################################################################# 
source ${proc_2dx}/2dx_cleanup_sub.com
############################################################################# 
############################################################################# 
#
if ( ${cleanup_mask} == "y" ) then
  \rm -f ${nonmaskimagename}_mask.mrc
  \rm -f ${nonmaskimagename}_automask.mrc
  \rm -f ${nonmaskimagename}_automask_mask.mrc
endif
#
echo "<<@progress: 100>>"
#
############################################################################# 
${proc_2dx}/linblock "Cleanup finished correctly..... All Gone."
#############################################################################
